package iteratorbind.impl;

import iteratorbind.base.BaseMenu;
import iteratorbind.entity.MenuItem;

import java.util.HashMap;
import java.util.Iterator;


/**使用Map存储菜单对象
 * @author yaojianfeng
 */
public class MenuItemHashMap implements BaseMenu {
    private HashMap<String,MenuItem> menus;

    public MenuItemHashMap (HashMap<String,MenuItem> menus) {
        this.menus = menus;
    }
    public MenuItemHashMap () {

    }

    /**
     * 返回集合遍历的迭代器
     * @return 迭代器
     */
    @Override
    public Iterator getIterator(){
        return menus.values().iterator();
    }

    public HashMap<String,MenuItem> getMenus() {
        return menus;
    }

    public void setMenus(HashMap<String,MenuItem> menus) {
        this.menus = menus;
    }
}
